<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        发布代码管理
        <small>管理后台左侧菜单、按钮等需要加入到权限控制的资源</small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="{{urlfor "HomeController.Index"}}">
                <i class="fa fa-dashboard"></i> 首页</a>
        </li>
        <li class="active">代码管理</li>
    </ol>
</section>
<!-- Content Header (Page header) -->
<section class="content container-fluid">
    <!-- 页面内容开始 -->
    <div class="row">
        <div class="col-md-12">
            <div class="box box-solid">
                <div class="box-body">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="btn-group">
                                {{ if .canEdit}}
                                    <button class="btn btn-info" href="javascript:;" onclick="EditFun()">
                                        <i class="fa fa-plus"></i> 添加
                                    </button>
                                {{end}}
                            </div>
                        </div>
                        <div class="col-md-6 align-right">
                            <div class="btn-group">
                                <button class="btn btn-warning treegridexpend" data-target="#treeGrid">
                                    <i class="fa fa-expand"></i> 全部展开
                                </button>
                                <button class="btn btn-primary treegridcollapse" data-target="#treeGrid">
                                    <i class="fa fa-compress"></i> 全部收缩
                                </button>
                            </div>
                        </div>
                    </div>
                    <table id="treeGrid" class="table  table-bordered table-hover margin-top-10">
                        <thead>
                        <th>名称</th>
                        <th class="align-center">图标</th>
                        <th class="align-center">类别</th>
                        <th>地址</th>
                        <th class="align-center">顺序</th>
                        <th style="width:120px;">操作</th>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
        <div class="col-md-12" id="gitlist">

        </div>
    </div>
    <script>


        var interval = setInterval(gitlist, 2000);

        function gitlist() {
            console.log("执行开始");
            $.ajax({
                url: "http://127.0.0.1:8080/git/show",
                success: function (result) {
                    // $("#gitlist").append("<div class=\"box box-solid\">" + result.data +"</div>");
                    $("#gitlist").html("");
                    // console.log(result.data);
                    for (i = 0; i < result.data.length; i++) {
                        if (result.data[i] == "exit") {
                            clearInterval(interval);
                            console.log("执行完毕");
                        }
                        $("#gitlist").append("<div class=\"box box-solid\">" + result.data[i] + "</div>");
                    }
                    clearInterval(interval);
                }
            });

        }

    </script>
    <!-- 页面内容结束 -->
</section>
<!-- /.content -->

